package com.wcity.manage.web.property;

import com.wcity.manage.common.context.SessionKey;
import com.wcity.manage.dao.dal.model.PageModel;
import com.wcity.manage.dao.mapper.VisitRegisterMapper;
import com.wcity.manage.dao.model.User;
import com.wcity.manage.dao.model.VisitRegister;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by wang on 2017/7/19.
 */
@Controller
public class PropertyVisitRegister {

    @Resource
    VisitRegisterMapper mapper;

    @RequestMapping("visitlist")
    public String getIVisitManage(VisitRegister register, PageModel pageModel, HttpServletRequest request){
        User user = (User) request.getSession().getAttribute( SessionKey.SESSION_USER_INFO );
        register.setUserId(user.getId());
        pageModel.setParams( register );
        request.setAttribute("list",mapper.findListPage(pageModel));
        request.setAttribute("pageModel",pageModel);
        request.setAttribute("register",register);
        request.setAttribute( "userId", user.getId() );
        request.setAttribute( "workNo", user.getWorkNo() );
        return "VisitRegister/visitlist";
    }
}
